# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com
# Contributor: Timothy Redaelli <timothy.redaelli+aur@gmail.com>

pkgname=jitterentropy
_pkgname=$pkgname-library
pkgver=3.4.1
pkgrel=1
pkgdesc='Hardware RNG based on CPU timing jitter'
arch=('loong64' 'x86_64')
url='https://www.chronox.de/jent.html'
license=('BSD' 'GPL2')
depends=('glibc')
source=(https://www.chronox.de/jent/$_pkgname-$pkgver.tar.xz{,.asc})
sha256sums=('802f025f766c38abf663fd5a21482b8313b6d6e2c68c36a4ffd6bc105fe975ab'
            'SKIP')
validpgpkeys=(3BCC43D4D2C87D1784B69EE4421EE936326AC15B)

prepare() {
  cd "$_pkgname-$pkgver"

  # Disable man page compression on install
  sed -e '/\tgzip .*\/man\// d' -i Makefile
  # Let the package manager handle stripping
  sed -e '/\tinstall.*-s / s/-s //g' -i Makefile
}

build() {
  cd "$_pkgname-$pkgver"
  LDFLAGS=-lpthread make jitterentropy
}

package() {
  cd "$_pkgname-$pkgver"
  install -dm755 "$pkgdir/usr/include"
  make PREFIX=/usr DESTDIR="$pkgdir/" install
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 LICENSE.bsd "$pkgdir/usr/share/licenses/$pkgname/LICENSE.bsd"
}

# vim:set ts=2 sw=2 et:
